import request from '../utils/request'

// 查看角色列表
export function getTableInfo (index, pageSize, token) {
  return request.get('system/authority/roleList', {
    params: {
      index, pageSize, token
    }
  })
}

// 保存角色类型
export function saveRoleType (crmAuthorityDTO) {
  return request.post('system/authority/saveRoleType', crmAuthorityDTO)
}

// 根据roleId获取角色信息
export function getRole (roleId) {
  return request.get(`system/authority/getRole?roleId=${roleId}`)
}

// 编辑角色类型
export function updateRoleType (crmAuthorityDTO, roleId) {
  return request.post('system/authority/updateRoleType', crmAuthorityDTO, {
    params: {
      roleId
    }
  })
}

// 删除角色类型
export function deleteRoleType (roleId) {
  return request.post(`system/authority/deleteRoleType?roleId=${roleId}`)
}

// 获取后台管理权限
export function getPermissions () {
  return request.get('system/authority/permissions')
}

// 获取项目后台管理权限
export function getProjectPermissions () {
  return request.get('/system/authority/project/permissions')
}
